// package hn.cch.spring_boot_security_rest.security;// package hn.cch.spring_boot_security_rest.filter;
//
// import org.slf4j.Logger;
// import org.slf4j.LoggerFactory;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.security.access.AccessDecisionManager;
// import org.springframework.security.access.SecurityMetadataSource;
// import org.springframework.security.access.intercept.AbstractSecurityInterceptor;
// import org.springframework.security.access.intercept.InterceptorStatusToken;
// import org.springframework.security.web.FilterInvocation;
// import org.springframework.stereotype.Component;
//
// import javax.servlet.Filter;
// import javax.servlet.FilterChain;
// import javax.servlet.ServletException;
// import javax.servlet.ServletRequest;
// import javax.servlet.ServletResponse;
// import java.io.IOException;
//
// @Component
// public class SecurityInterceptorFilter extends AbstractSecurityInterceptor implements Filter {
//
//
//     private static Logger logger = LoggerFactory.getLogger(SecurityInterceptorFilter.class);
//
//     @Autowired
//     private SecurityMetadataSourceImpl securityMetadataSource;
//
//     @Autowired
//     public void setAccessDecisionManagerImpl(AccessDecisionManager accessDecisionManager) {
//         super.setAccessDecisionManager(accessDecisionManager);
//     }
//
//     @Override
//     public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//         logger.info("filter");
//         FilterInvocation filterInvocation = new FilterInvocation(servletRequest, servletResponse, filterChain);
//         InterceptorStatusToken interceptorStatusToken = super.beforeInvocation(filterInvocation);
//         try {
//             //执行下一个拦截器
//             filterInvocation.getChain().doFilter(filterInvocation.getRequest(), filterInvocation.getResponse());
//         } finally {
//             super.afterInvocation(interceptorStatusToken, null);
//         }
//     }
//
//
//
//     @Override
//     public Class<?> getSecureObjectClass() {
//         return FilterInvocation.class;
//     }
//
//     @Override
//     public SecurityMetadataSource obtainSecurityMetadataSource() {
//         return this.securityMetadataSource;
//     }
// }
